---
- name: Update packages
  hosts: localhost
  tasks:
    - name: Update apt
      become: true
      when: ansible_os_family == "Debian"
      ansible.builtin.apt:
        cache_valid_time: "{{ cache_valid_time }}"
        update_cache: true
        upgrade: true

    - name: Update brew
      when: ansible_distribution == "MacOSX"
      community.general.homebrew:
        update_homebrew: true
        upgrade_all: true
